package com.ExaminStudy;

import java.util.Scanner;

public class Test5_2_2 {
    public static void main(String[] args) {
      Scanner sc=new Scanner(System.in);
        System.out.println("请你输入要输入的数字个数n");
        int n=sc.nextInt();
        int[]arr=new int[n];
        int max=arr[0];
        int min=arr[0];
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请你输入第"+(i+1)+"个数");
            arr[i]=sc.nextInt();
        }
        for (int i = 0; i < arr.length; i++) {
            if(max<arr[i]){
                max=arr[i];
            }
            if(min>arr[i]){
                min=arr[i];
            }
        }

        System.out.println("最大值是"+max+"最小值是"+min);
    }
}
